<#include "/includes/son.ftl">

<div class="container-fluid">
    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-toolbar clearfix">
                    <div class="toolbar-btn-action">
                        <a class="btn btn-primary m-r-5" id="addBtn" href="#!"><i class="mdi mdi-plus"></i> 新增</a>
                    </div>
                </div>


                <div class="card-body">
                    <div class="table-responsive">
                        <table class="table">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>分类名称</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <#list iPage.records as ip>
                                <tr>
                                    <td>${ip.id}</td>
                                    <td>${ip.typeName}</td>
                                    <td>
                                        <div class="btn-group">
                                            <a id="${ip.id}" class="btn btn-xs btn-default ediBtn" href="#!" title="" data-toggle="tooltip" data-original-title="编辑"><i class="mdi mdi-pencil"></i></a>
                                            <a id="${ip.id}" class="btn btn-xs btn-default delBtn" href="#!" title="" data-toggle="tooltip" data-original-title="删除"><i class="mdi mdi-window-close"></i></a>
                                        </div>
                                    </td>
                                </tr>
                            </#list>
                            </tbody>
                        </table>
                        <ul id="pagination1" class="pagination"></ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    var pageTotal='<#if iPage.total??>${iPage.total}</#if>'==''?1:${iPage.total};
    var pageSize='<#if iPage.size??>${iPage.size}</#if>'==''?10:${iPage.size};
    var currentPage='<#if iPage.current??>${iPage.current}</#if>'==''?1:${iPage.current};
    showPage(pageTotal,pageSize,currentPage);
</script>

<script>
    $(function (){
        $("#addBtn").click(function (){
            window.location.href = "/goods/shopGoodsType/goodsTypeEdit"
        })
        $(".ediBtn").click(function (){
            window.location.href = "/goods/shopGoodsType/goodsTypeEdit?id="+this.id
        })
        $(".delBtn").click(function (){
            $.post("/goods/shopGoodsType/goodsTypeDel",{id:this.id},function (res){
                lightyear.notify(res.data, 'success', 5000, 'mdi mdi-emoticon-happy', 'top', 'center');
            })
        })
    })
</script>